const gulp = require('gulp');
const fs = require('fs');
const {series, parallel} = gulp;
exports.test = (done) => {
    console.log('test');
    done();
}
exports.default = (done) => {
    console.log('default');
    done();
}

const task1 = (done) => {
    console.log('task1 start');
    setTimeout(() => {
        console.log('task1 end');
        done();
    }, 3000)
};
gulp.task('task2', (done) => {
    console.log('task2 start');
    setTimeout(() => {
        console.log('task2 end');
        done();
    }, 3000)
})
gulp.task('task3', (done) => {
    console.log('task3 start');
    setTimeout(() => {
        console.log('task3 end');
        done();
    }, 3000)
})
exports.series1 = series(task1, 'task2', 'task3');
exports.p1 = parallel(task1, 'task2', 'task3');
exports.async1 = (done) => {
    console.log('async1');
    done(new Error('async1 error'));
}
exports.stream = (done) => {
    const readStream = fs.createReadStream('package.json');
    const writeStream = fs.createWriteStream('test.json');
    readStream.pipe(writeStream);
    readStream.on('end', () => {
        done();
    })
}